package com.huawei;

import java.util.Scanner;

/**
 * Created by Z-hong on 2024/7/4.
 */

public class HJ17 {
    public static int A[]={-1,0};
    public static int S[]={0,-1};
    public static int W[]={0,1};
    public static int D[]={1,0};
    public static int result[]={0,0};

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String str=sc.nextLine();
        String strArr[]=str.split(";");
        for (String s : strArr) {
            addResult(s);
        }
        System.out.println(result[0]+","+result[1]);

    }

    public static void addResult(String str){
        int [] move= new int[2];
        char[] arr=str.toCharArray();
        if(arr.length<2||arr.length>3){return;}
        switch(arr[0]){
            case 'A':
                move=A.clone();
                break;
            case 'S':
                move=S.clone();
                break;
            case 'W':
                move=W.clone();
                break;
            case 'D':
                move=D.clone();
                break;
            default:
                return ;
        }
        //把arr[0]去掉，组成一个新数组
        String char_s=String.valueOf(arr,1,arr.length-1);
        //判断char_s是否为数字
        if(!char_s.matches("\\d+")){return ;}
        int num=Integer.parseInt(char_s);
        result[0]=num*move[0]+result[0];
        result[1]=num*move[1]+result[1];
        return ;
    }
}
